package oauth

import (
	"context"
	model "micro-oauth/datamodels"
	"micro-oauth/datamodels/autherror"
	"micro-oauth/datamodels/params"
)

func (s *OauthServiceImpl) ListClient(ctx context.Context, req *params.ClientListRequest) (clients []*model.Client, total uint64, hexerr autherror.HexError) {
	pId := ctx.Value("partner_id").(uint64)
	req.PartnerId = pId
	clients, total, err := s.repoService.ListClient(req)
	if err != nil {
		return nil, 0, autherror.DBError(err.Error())
	}
	return clients, total, nil
}
